package redis

import (
	"context"
	"time"
)

const (
	VcID = "vc_id:" //video->comment
)

func (r Redis) SetHash(key string, value map[string]string, duration time.Duration) (err error) {
	if err := r.Client.HSet(context.Background(), key, value).Err(); err != nil {
		return err
	}
	return r.Client.Expire(context.Background(), key, duration).Err()
}
func (r Redis) GetHashToField(key, field string) (res string, err error) {
	return r.Client.HGet(context.Background(), key, field).Result()
}
func (r Redis) GetAllHash(key string) (res map[string]string, err error) {
	return r.Client.HGetAll(context.Background(), key).Result()
}
